package com.mywork.mvpkodeinxml.rx

import com.mywork.mvpkodeinxml.base.view.BaseView
import io.reactivex.Observer
import io.reactivex.disposables.Disposable


abstract class BaseSubscriber<T>(val baseView: BaseView) : Observer<T> {
    override fun onSubscribe(d: Disposable) {

    }

    abstract override fun onNext(t: T)

    override fun onComplete() {

    }

    override fun onError(e: Throwable) {
        if (e is BaseException) {
            baseView.showToast(e.msg)
        }
        e.printStackTrace()
    }

}